<template>
    <div class="dialog">
        <lb-header :title="'发布'" @close="closefun"></lb-header>
        <input type="text" placeholder="请输入用户名" v-model="name">
        <input type="text" placeholder="请输入标题" v-model="title">
        <input type="text" placeholder="请输入内容" v-model="con">
        <button class="public" @click='public'>发布</button>
    </div>
</template>
<script>
import LbHeader from '@/components/lbHeader'
import axios from 'axios'
export default {
    components:{
       LbHeader
    },
    data(){
        return {
            name:'',
            title:'',
            con:'',
        }
    },
    methods: {
        closefun(){
            this.$emit('close')
        },
        public(){
            axios.post("/api/add",{name:this.name,title:this.title,con:this.con}).then((res)=>{
                if(res.data.code == 1){
                    // console.log(res.date.data.msg)
                    this.$emit('close')
                }
            })
        }
    },
}
</script>
<style>
    .dialog{
        width:100%;
        height:100%;
        position:absolute;
        top:0;
        left:0;
        background:rgba(0,0,0,0.8);
    }
    input{
        width:80%;
        height:40px;
        margin:20px 10%;
    }
    .public{
        width:60%;
        height:30px;
        text-align:center;
        line-height:30px;
        margin: 0 20%;
    }
</style>